//
//  RecommendGameCell.swift
//  DouYuZB
//
//  Created by 梁森 on 2020/4/23.
//  Copyright © 2020 梁森. All rights reserved.
//

import UIKit

class RecommendGameCell: BaseCollectionViewCell {
    var anchorGroup:BaseGameModel?{
        didSet{
            titleLbl.text = anchorGroup?.tag_name
            iconView.lsSetImage(string: anchorGroup!.icon_url, placeholder: "home_more_btn")
        }
    }
    private var titleLbl:UILabel = {
        let titleLbl = UILabel()
        titleLbl.font = UIFont.systemFont(ofSize: 15)
        titleLbl.textColor = UIColor.darkGray
        titleLbl.text = "游戏"
        return titleLbl
    }()
    private var iconView:UIImageView = {
        let iconView = UIImageView()
        iconView.layer.cornerRadius = 45 * 0.5
        iconView.layer.masksToBounds = true
        return iconView
    }()
    override init(frame: CGRect) {
        super.init(frame: frame)
        setupSubviews()
    }
    
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
}
// MARK: 设置UI
extension RecommendGameCell{
    func setupSubviews() {
        addSubview(titleLbl)
        addSubview(iconView)
        titleLbl.snp.makeConstraints { (make) in
            make.bottom.equalTo(self.snp.bottom).offset(-10)
            make.centerX.equalTo(self.snp.centerX)
        }
        iconView.snp.makeConstraints { (make) in
            make.bottom.equalTo(titleLbl.snp.top).offset(-5)
            make.centerX.equalTo(self.snp.centerX)
            make.width.equalTo(45)
            make.height.equalTo(45)
        }
    }
}
